#ifndef SYS_MDNS_H 
#define SYS_MDNS_H 

#include <thread>
#include <mutex>
#include "MdnsServices.h"
#include "MdnsService.h"
#include <string>
#include <set>
#include <vector>
namespace Media{

using namespace std;

struct NetworkDeviceAbility{
	string serverName;
	//先放一个RTSP，后续加入其他的网络设备能力
	int rtspBility;

	string ip;

	 // 定义结构体的比较规则，进行排序
    bool operator<(const NetworkDeviceAbility& other) const {
        return serverName < other.serverName;
    }
}; 


#define SYS_NETCFG_FILE        "/mnt/mtd/net.cfg"
class Mdns{
public:
	static Mdns *instance();
	bool browserNetWorkDevice(set<NetworkDeviceAbility> & deviceList);
	~Mdns();
private:
	Mdns();
	void *startMdns();
	//线程
	std::vector<std::string> stringSplit(const std::string& str, char delim);

	bool Mdns::getCmdInfo(char *cmd, vector<string> &info);
	DeviceInfo ParseDeviceMDnsData(const std::string &src_device_info);
	static Mdns *sm_Mdns;
	static mutex sm_instanceLock;
};
}
#endif
